#region Summary

// 
// Owner : JackieHan 
// 
// Solution : LearnSolution
// 
// Project :Project
// 
// File : AccountService.cs
// 
// CopyRight : Copyright © 2010-2011 Skomart Corporation, All Rights Reserved 
// 
// Summary : Summary
// 
// History : 
//			2010-11-24 11:58:14	    Create 
// 

#endregion

#region Using

using System;
using System.Collections.Generic;

#endregion

namespace JackieHan.DotNet.NMockExample
{
    /// <summary> 
    /// Summary
    /// </summary>
    public class AccountService:IAccountService
    {
        private readonly ICurrencyService currencyService;

        public AccountService(ICurrencyService currencyService)
        {
            this.currencyService = currencyService;
        }

        public void TransferFunds(Account from, Account to, double amount)
        {
            from.Withdraw(amount);
            double conversionRate = currencyService.GetConversionRate(from.Currency, to.Currency);
            double conversionAmount = amount*conversionRate;
            to.Deposit(conversionAmount);
        }
    }
}